Package aspect.example

Source Code of aspect.example.SpaceObject

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package aspect.example;

import aspect.entity.Entity;
import aspect.physics.RigidBody;
import aspect.physics.dynamics.Force;
import aspect.physics.dynamics.PointGravity;
import aspect.render.ViewModel;
import aspect.world.World;

/**
*
* @author MillerV
*/
public class SpaceObject extends Entity {
    private final Force gravity;
    public SpaceObject(ViewModel model, float mass) {
        super(model);

        RigidBody rb = new RigidBody(World.main);
        rb.mass = mass;
        addBehavior(rb);
       
        gravity = new PointGravity(this);
        World.main.addForce(gravity);
    }
   

    @Override
    public void onRemove() {
        super.onRemove();
        World.main.removeForce(gravity);
    }
}
TOP

Related Classes of aspect.example.SpaceObject

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.